package com.huluobo.a2111douyindemo.home.tabItem;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.a2111douyindemo.R;
import com.huluobo.a2111douyindemo.utils.ImageLoader;
import com.huluobo.mvvm_base.mvvm.bean.VideoBeanResult;

import java.util.List;

/**
 * Created by LC on 2024/2/26.
 */
public class CommonAdapter extends BaseQuickAdapter<VideoBeanResult.VideoBean, BaseViewHolder> {
    public CommonAdapter(@Nullable List<VideoBeanResult.VideoBean> data) {
        super(R.layout.item_home_video, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, VideoBeanResult.VideoBean videoBean) {
        baseViewHolder.setText(R.id.item_video_desc, videoBean.getCaption());
//        Glide.with(getContext()).load(videoBean.getVideomainimg()).into((ImageView) baseViewHolder.getView(R.id
//        .item_video_icon));
        ImageLoader.getInstance().loadCircleImage(getContext(), videoBean.getVideomainimg(),
                (ImageView) baseViewHolder.getView(R.id.item_video_icon));
        //点赞状态.0代表未点赞,1代表点赞
        if (videoBean.getDianzan() == 0) {
            baseViewHolder.setImageResource(R.id.item_video_like, R.drawable.baseline_favorite_border_24);
        } else {
            baseViewHolder.setImageResource(R.id.item_video_like, R.drawable.like);
        }
    }
}
